package com.hwx.order_feign.controller;

import com.alibaba.fastjson.JSONObject;
import com.hwx.order_feign.feign.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Desc: 订单服务控制器(基于Feign组件)
 * @Author: hwx
 * @Date: 2020/5/26 14:46
 * @Version: v1.0
 **/
@RestController
@RequestMapping(value = "/order")
public class OrderController {

	@Autowired
	private ProductFeignClient productFeignClient;


	@GetMapping(value = "/buy/{id}")
	public JSONObject findById(@PathVariable Integer id) {
		JSONObject product = productFeignClient.findById(id);
		return product;
	}
}
